package com.power.util;

import java.util.Arrays;
import java.util.List;

public class MonthUtil {

	public static List<String> MONTH_LIST = Arrays.asList("ZERO", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL",
			"AUG", "SEP", "OCT", "NOV", "DEC");

	public static String changeStringToNumber(String releaseVersion) {
		if (null == releaseVersion) {
			throw new IllegalArgumentException("ReleaseVersion cannot be null");
		}
		for (int i = 0; i < MONTH_LIST.size(); i++) {
			if (releaseVersion.toUpperCase().startsWith(MONTH_LIST.get(i))) {
				if (i < 10) {
					return "0" + i;
				}
				return i + "";
			}
		}
		return -1 + "";
	}

}
